package com.macro.mall.portal.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.macro.mall.portal.domain.Appraisal;
import com.macro.mall.portal.service.IConsultFilesService;
import com.macro.mall.portal.dao.ConsultFilesMapper;
import com.macro.mall.portal.domain.ConsultFiles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 查档表、过户价表 服务实现类
 * @author db
 * @since 2021-07-04
 */
@Service
public class ConsultFilesServiceImpl extends ServiceImpl<ConsultFilesMapper, ConsultFiles> implements IConsultFilesService {

    @Autowired
    private ConsultFilesMapper consultFilesMapper;

    @Override
    public void addOne(ConsultFiles consultFiles) {
        consultFilesMapper.insert(consultFiles);
    }

    @Override
    public IPage<ConsultFiles> selectBy(String openId, Integer page, Integer size) {
        QueryWrapper<ConsultFiles> wrapper = new QueryWrapper<>();
        wrapper.eq("open_id", openId);
        wrapper.orderByDesc("create_time");
        Page<ConsultFiles> userPage = new Page<>(page, size);
        IPage<ConsultFiles> consultFiles = consultFilesMapper.selectPage(userPage, wrapper);
        return consultFiles;
    }


    @Override
    public void deleteOne(String id) {
        consultFilesMapper.deleteById(id);
    }
}
